package com.chanyachting.emall.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import com.chanyachting.emall.util.RequestUtil;

public class PeriodicalForm extends ActionForm {
	
	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String magazineId;
	private java.lang.String endMonth;
	private java.lang.String year;
	private java.lang.String startMonth;
	private java.lang.String status;
	private java.lang.String createDate;
	private java.lang.String serialNumber;
	
	
	
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		
		ActionErrors errors=new ActionErrors();
		
		RequestUtil ru=new RequestUtil(request);
		
		if(this.getYear()==null || this.getYear().equals("")){
			
			errors.add("periodicalerror",new ActionMessage(""));
			
			ru.setMsg("Year must not null!");
			
		}
		
		if(this.getSerialNumber()==null || this.getSerialNumber().equals("")){
			
			errors.add("periodicalerror",new ActionMessage(""));
			
			ru.setMsg("SerialNumber must not null!");
		}
		
		return errors;
	}
	
	
	public java.lang.String getStatus() {
		return status;
	}
	public void setStatus(java.lang.String status) {
		this.status = status;
	}
	public java.lang.Integer getId() {
		return id;
	}
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public java.lang.String getMagazineId() {
		return magazineId;
	}
	public void setMagazineId(java.lang.String magazineId) {
		this.magazineId = magazineId;
	}
	public java.lang.String getEndMonth() {
		return endMonth;
	}
	public void setEndMonth(java.lang.String endMonth) {
		this.endMonth = endMonth;
	}
	public java.lang.String getYear() {
		return year;
	}
	public void setYear(java.lang.String year) {
		this.year = year;
	}
	public java.lang.String getStartMonth() {
		return startMonth;
	}
	public void setStartMonth(java.lang.String startMonth) {
		this.startMonth = startMonth;
	}
	
	public java.lang.String getCreateDate() {
		return createDate;
	}
	public void setCreateDate(java.lang.String createDate) {
		this.createDate = createDate;
	}
	public java.lang.String getSerialNumber() {
		return serialNumber;
	}
	public void setSerialNumber(java.lang.String serialNumber) {
		this.serialNumber = serialNumber;
	}
	
	

}
